/**
 *  Copyright (C) 2008-2013  Telosys project org. ( http://www.telosys.org/ )
 *
 *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *          http://www.gnu.org/licenses/lgpl.html
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.telosys.persistence.dao;

import java.lang.reflect.Field;


/**
 * Interface to be implemented by every "specialized FieldMapper"
 * 
 * @author Laurent Guerin
 *
 */
public interface SpecializedFieldMapper 
{

	/**
	 * Set the object field value in the given QueryContext in order to insert/update the associated database table
	 * @param bean
	 * @param field
	 * @param queryContext
	 * @param index
	 * @throws IllegalAccessException
	 */
	void   beanToTable( Object bean, Field field, QueryContext queryContext, int index  ) throws IllegalAccessException;
	
	/**
	 * Populate the object field value with data retrieved from the database table (after SQL request)
	 * @param bean
	 * @param field
	 * @param queryContext
	 * @param index
	 * @throws IllegalAccessException
	 */
	void   tableToBean( Object bean, Field field, QueryContext queryContext, int index  ) throws IllegalAccessException ;
	
	/**
	 * Set the object field value with the given value
	 * @param bean
	 * @param field
	 * @param value
	 */
	void   setValue( Object bean, Field field, Object value ) ;
	
	/**
	 * Get the object field value 
	 * @param bean
	 * @param field
	 * @return
	 */
	Object getValue( Object bean, Field field ) ;
	
}
